package com.hqyj.springBoot.modules.common.controller;

import com.hqyj.springBoot.modules.common.entity.ResultEntity;
import com.hqyj.springBoot.modules.common.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author yun
 * @date 2021-5-5 13:06
 */
@RestController
@RequestMapping("/api")
public class ImageController {

    @Autowired
    private ImageService imageService;

    /**
     * 127.0.0.1/api/image/profile_big ---- post
     */
    @PostMapping(value= "/image/{imageType}",consumes = "multipart/form-data")
    public ResultEntity<String> uploadImage(@RequestParam("image") MultipartFile image,@PathVariable String imageType){
        return imageService.uploadImage(image, imageType);
    }
}
